package com.tian.service.impl;

import com.alibaba.fastjson.JSON;
import com.tian.entity.StationGunCommunicateLog;
import com.tian.message.StationGunCommunicateLogMessage;
import com.tian.service.StationGunCommunicateLogService;
import org.redisson.api.RBucket;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Service;
import plus.ojbk.influxdb.core.InfluxdbTemplate;

import javax.annotation.Resource;

/**
 * {@code @description:} 电桩设备通信日志服务实现类
 *
 * @author tianwc 公众号：Java后端技术全栈
 * 在线刷题 1200+java面试题和1000+篇技术文章：<a href="https://woaijava.cc/">博客地址</a>
 * {@code @date:} 2024-08-23 16:59
 * {@code @version:} 1.0
 */
@Service
public class StationGunCommunicateLogServiceImpl implements StationGunCommunicateLogService {
    @Resource
    private InfluxdbTemplate influxDBTemplate;
    @Override
    public boolean save(StationGunCommunicateLogMessage stationGunCommunicateLogMessage) {
        StationGunCommunicateLog stationGunCommunicateLog = new StationGunCommunicateLog();
        stationGunCommunicateLog.setGunNo(stationGunCommunicateLogMessage.getGunNo());
        stationGunCommunicateLog.setTime(stationGunCommunicateLogMessage.getLogTime());
        stationGunCommunicateLog.setLogType(stationGunCommunicateLogMessage.getLogType());
        stationGunCommunicateLog.setParams(stationGunCommunicateLogMessage.getParams());
        influxDBTemplate.insert(stationGunCommunicateLog);
        return true;
    }
}
